package com.cabinet;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: lesya
 * Date: 2/2/14
 * Time: 8:25 PM
 * To change this template use File | Settings | File Templates.
 */
public class CodesBlock {
  List<Byte> list = new ArrayList<>();
  void readFinish(){
    if( list.size()!=21 ){
      throw new IllegalStateException("codes block size must be 21, actually "+list.size());
    }
  }
  void addCode(String bin){
    // b00011000
    if( ! bin.startsWith("b") ){
      throw new IllegalArgumentException("broken code "+bin);
    }
    list.add( new Byte((byte)(0xff & Integer.parseInt(bin.substring(1), 2))) );
  }
}
